<!DOCTYPE html>
<html>

	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link href="__STATIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<script type="text/javascript" src="__STATIC__/jquery-2.1.3.js"></script>
		<link href="__STATIC__/cropper/cropper.min.css" rel="stylesheet" media="screen" />
		<script src="__STATIC__/cropper/cropper.min.js"></script>
		<script src="__STATIC__/cropper/crop_lact_add.js"></script>
		<link href="__STATIC__/bootstrap/b-date/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
		<script src="__STATIC__/bootstrap/b-date/bootstrap-datetimepicker.min.js"></script>
		<script src="__STATIC__/bootstrap/b-date/bootstrap-datetimepicker.zh-CN.js"></script>
		<style>
			body {
				margin: 0;
			}
			label {
				color: grey;
			}
			.highlight {
				border: 1px solid #e1e1e8;
				background: #fff;
				border-radius: 4px;
				margin: 0;
				padding: 15px 0 0;
			}
			.pt5 {
				padding-top: 5px;
			}
			.alert {
				margin-bottom: 0;
			}
		</style>
	</head>

	<body>
		<!-- top -->
		<div class="container">
			<div class="row">
				<!-- right -->
				<div class="col-md-12">
					<div class="row" style="margin:5px 0;">
						<div id="actTips" class="col-xs-12 alert alert-info">
							<h5>小秘书提示：你可以在这里发起轮播图</h3>
						</div>
					</div>
					<div class="row highlight form-horizontal" style="padding:5px 10px;">
							<form action="{:U('Activity/lact_save')}" id="formUrl"  method="post" enctype="multipart/form-data">
								<input type="hidden" id="aid" name="aid" value="{$act.id}"/>							
								<!--轮播图片 -->
								<div class="form-group">
									<label for="title" class="col-xs-2 control-label">轮播图片：</label>
									<div class="col-xs-6">
										<input type="file" name="imgurl" class="form-control" id="imgurl">
									</div>
									<div class="col-xs-3 pt5"><code id="logo_err">比例：2:1</code>
									</div>
								</div>
								<!--图片预览-->
								<div class="form-group" id="img_preview">
									<div class="docs-data" hidden="hidden">
										<input class="form-control" id="dataX" name="dataX" type="text" placeholder="x">
										<input class="form-control" id="dataY" name="dataY" type="text" placeholder="y">
										<input class="form-control" id="dataWidth" name="dataWidth" type="text" placeholder="width">
										<input class="form-control" id="dataHeight" name="dataHeight" type="text" placeholder="height">
									</div>
									<label for="title" class="col-xs-2 control-label">图片预览：</label>
									<div class="col-md-7">
										<div class="row">
											<div class="col-md-10">
												<div class="img-container">
													<img id="showimg">
												</div>
											</div>
										</div>
									</div>
								</div>
							<!--活动链接-->
							<div class="form-group">
								<label class="col-xs-2 control-label">跳转链接:</label>
								<div class="col-xs-6">
									<input class="form-control" id="acturl" name="acturl" value="{$act.acturl}" placeholder="活动链接"/>
								</div>
								<div class="col-xs-4 pt5"><code id="logo_err">跳转链接</code>
								</div>
							</div>
							<!-- 轮播时间 -->
							<div class="form-group">
								<label for="atime" class="col-xs-2 control-label">轮播时间：</label>
								<div id="sdtp" class="col-xs-3 input-group date"  style="padding-left: 14px; padding-right: 10px;display: inline-table!important;">
									<input type="text" class="form-control" id="atime" name="atime" placeholder="轮播开始时间" readonly>
									<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
								</div>
								<div id="edtp" class="col-xs-3 input-group date" style="padding-left: 14px; padding-right: 10px;display: inline-table!important;">
									<input type="text" class="form-control" id="aetime" name="aetime" placeholder="轮播结束时间" readonly>
									<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
								</div>
							</div>
							<!--轮播顺序-->
							<div class="form-group">
								<label for="address" class="col-xs-2 control-label">轮播顺序：</label>
								<div class="col-xs-6">
									<input class="form-control" id="numorder" name="numorder" placeholder="轮播顺序 如 2">
								</div>
							</div>
							</form>
							<div class="form-group">
								<div class="col-xs-6 col-xs-offset-2">
									<button type="button" class=" form-control btn btn-success" id="sub">提交</button>
								</div>
							</div>
						
					</div>
				</div>
			</div>
		</div>
		<script>
			$('#sub').click(function(){
				var imgurl = $.trim($('#imgurl').val()),
				acturl = $('#acturl').val(),
				numorder = $('#numorder').val();
				if(!imgurl){alert('请选择轮播图片');return false;}
				if(!acturl){alert('请输入活动链接');return false;}
				if(!numorder){alert('请选择轮播顺序');return false;}
				$('#formUrl').submit();
			});
			function addHour(date, num) {
					date.setHours(date.getHours() + num);
					return date;
				}
				// 初始化开始时间控件

			function initSdtp() {
					$('#sdtp').datetimepicker({
							language: 'zh-CN',
							format: "yyyy-mm-dd",
							minView:2,
							todayBtn: 1,
							autoclose: 1,
							forceParse: 1,
							startDate: addHour(new Date(), 2),
							pickerPosition: "top-left"
						})
						.on('changeDate', function(ev) {
							$('#atime_err').hide();
							$('#aetime_err').hide();
							$('#edtp').datetimepicker('remove');
							initEdtp(new Date(Date.parse($('#atime').val().replace(/-/g, '/'))));
						});
				}
				// 初始化结束时间控件

			function initEdtp(date) {
				$('#edtp').datetimepicker({
						language: 'zh-CN',
						format: "yyyy-mm-dd",
						minView:2,
						autoclose: 1,
						forceParse: 1,
						startView: 2,
						startDate:date,
						pickerPosition: "top-left"
					})
					.on('changeDate', function(ev) {
						$('#aetime_err').hide();
					});
			}
			initSdtp();
		</script>
	</body>

</html>

</html>